package callingmechanism;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class MyClientInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        ChannelPipeline pipeline = socketChannel.pipeline();
        //入站加入解码器
        pipeline.addLast("decoder", new MyBateToLongDecoder());
        //出站加入编码器
        pipeline.addLast("encoder",new MyLongToByteEncoder());
        //自定义业务处理器
        pipeline.addLast(new MyClientHander());
    }
}
